UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FCecFBG2aNERLfr2xO5/0GmXZLH6h4ZkdseyyUD3Rmk=' 
WHERE 
  key_id = '52fb52e8b457592e7955b1f1f1bacb5d0c790b45ef771069c18e5660c6042498' 
  AND (
    token = 'FCecFBG2aNERLfr2xO5/0GmXZLH6h4ZkdseyyUD3Rmk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042