UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kvx6ttlBNUEeSg5DuWDyaW5Nhdy9KRm2vm/rC5aG3Ks=' 
WHERE 
  key_id = '12074c8ed7a5d477616ef2a40b43897742469ff9850af2f825643c7c667026ee' 
  AND (
    token = 'kvx6ttlBNUEeSg5DuWDyaW5Nhdy9KRm2vm/rC5aG3Ks=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022