UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xeQI20ZTnoM0FAm0dB8l8jRXxok2cYmF/77/TjTkPEw=' 
WHERE 
  key_id = '2d339816cc1062e98200fc47641a6ed43e75b3be6db843a36f890db353ffa5c3' 
  AND (
    token = 'xeQI20ZTnoM0FAm0dB8l8jRXxok2cYmF/77/TjTkPEw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00015