UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SrKF6xntyP1A+O69dSk96ica9wOQCYuPNmQhMUdccHc=' 
WHERE 
  key_id = '199df90c188df83e97b8e3e26988553c01f493c8139573610af24c4881ee6d72' 
  AND (
    token = 'SrKF6xntyP1A+O69dSk96ica9wOQCYuPNmQhMUdccHc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038