UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SfxRj4NQ+QgAN/KHnWHgxSeV9Ay1rjTCNWSff2+tkGI=' 
WHERE 
  key_id = 'a7196646a71b0b5b29ccbe60775223a1b50a059c1229be63eb32a5608404bfaa' 
  AND (
    token = 'SfxRj4NQ+QgAN/KHnWHgxSeV9Ay1rjTCNWSff2+tkGI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041