UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fmZDuu/1c5OOquiAJxInmZKGSNJvUTHNz0aQ1uO/1nM=' 
WHERE 
  key_id = '44e906d0d7c55d2ca57aa0cc4688b0bc1f3e63d3dece701e2e5b623cba73d155' 
  AND (
    token = 'fmZDuu/1c5OOquiAJxInmZKGSNJvUTHNz0aQ1uO/1nM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048