UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'h1Pvqms7NsGYstarFb1LC9IE3J6DxkzRnBhxb78yPPA=' 
WHERE 
  key_id = 'd36e1202929514568b5ecf08c71b2118f210d83e723165026bb84847350637c9' 
  AND (
    token = 'h1Pvqms7NsGYstarFb1LC9IE3J6DxkzRnBhxb78yPPA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040