UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZCxq3iDDuycAs2xF5bY3sMpOq2vITUHHR+WtnuuWAYA=' 
WHERE 
  key_id = '56b74211d6061d2febd18aef6a38ebdc93ccd08afe3f6ad3d25f82a2330d90b3' 
  AND (
    token = 'ZCxq3iDDuycAs2xF5bY3sMpOq2vITUHHR+WtnuuWAYA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027