UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'K5DJ0qQV7y6xNVIheoH8rRTx8yR//OliQ9uAy/IeIpA=' 
WHERE 
  key_id = '063f2171b3ee16b0443fb269879eb4eedd3018db4dd7235061ee2f5af9046ec1' 
  AND (
    token = 'K5DJ0qQV7y6xNVIheoH8rRTx8yR//OliQ9uAy/IeIpA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021