UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YIv5zGvWQncmp+7Nlk92fPQ52Nzu/AXr6DUBiPj07Wo=' 
WHERE 
  key_id = '09f7fea54478465f71afe2562414e3bfe0e225b33c99e330d9f5505ea5cddcbb' 
  AND (
    token = 'YIv5zGvWQncmp+7Nlk92fPQ52Nzu/AXr6DUBiPj07Wo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017