UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QhNOjDs6eTtHjcutwcsBk057UfdmuM6xgYDcyxLWSZ8=' 
WHERE 
  key_id = '90362846db888730aab5d1048951e736712551da3659b4c0b225e494c35ef0e7' 
  AND (
    token = 'QhNOjDs6eTtHjcutwcsBk057UfdmuM6xgYDcyxLWSZ8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00086