UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TH3Xx/+w0lqpA+prCMGtNfFwklYUHn6d0YDpQh53fU4=' 
WHERE 
  key_id = 'f6a3d3a665db26a5b4cb795541486b3da702f49c13641249d748d666bc580bf1' 
  AND (
    token = 'TH3Xx/+w0lqpA+prCMGtNfFwklYUHn6d0YDpQh53fU4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040