UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5h8le2y2Ufz1U3h80iF+3fzDkhgzqRU8WHO3GZ2BIC4=' 
WHERE 
  key_id = 'e58c40bae94cb069ecb8fc6ccd18b8f8eceffd300bff9e6b599277241022f78c' 
  AND (
    token = '5h8le2y2Ufz1U3h80iF+3fzDkhgzqRU8WHO3GZ2BIC4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026