UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vgywMayqBjnO5fZ1DsLMh65de2GXjhKNs4NlxAOr3vA=' 
WHERE 
  key_id = '5511965c82d5184f71153d824f70b43b4692ad4298a48289c57805fde6b8e24a' 
  AND (
    token = 'vgywMayqBjnO5fZ1DsLMh65de2GXjhKNs4NlxAOr3vA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026