UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JboN5DkoUoIv1JlV8Dww13o2Kw7vBhsAQtStr2OF8fA=' 
WHERE 
  key_id = '6f197d8fdf32a11376eb609e9fade9ef664c73d43e7de0577824675809027a14' 
  AND (
    token = 'JboN5DkoUoIv1JlV8Dww13o2Kw7vBhsAQtStr2OF8fA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024