UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HaAx/b18q1kArn6QC4g/E0yu27tw4kmBqbcLAJI7m6c=' 
WHERE 
  key_id = '108b3a46100df1bc9a772954845c2e1ac235ff074a80efa95413fa47283618f4' 
  AND (
    token = 'HaAx/b18q1kArn6QC4g/E0yu27tw4kmBqbcLAJI7m6c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033