UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fYEpsBFIVXsObd0cFGSebzat18sJV4KVwZrghK7A4qM=' 
WHERE 
  key_id = '9f4a5c4ec2d9e5eaae10ce233461b7aa89a3c76a2033e46fd75dbf16c1d9f212' 
  AND (
    token = 'fYEpsBFIVXsObd0cFGSebzat18sJV4KVwZrghK7A4qM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030