UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wmT8ynNwVI0vjM0EvnveS5Z9cIa6nVgM+A64BV0e0Z8=' 
WHERE 
  key_id = '4befe3ac059e31e0d313a91f384fe6eab6fb2007d6805936ef3619b5421804e1' 
  AND (
    token = 'wmT8ynNwVI0vjM0EvnveS5Z9cIa6nVgM+A64BV0e0Z8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031