UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XJDneDRZoFsA8nfyigel11QCT2/i0/dFMN0Vp7vSMI8=' 
WHERE 
  key_id = '225f4ecef4023bda38c13ae48c890593491dc032fd30e0698b3a65efa35acd59' 
  AND (
    token = 'XJDneDRZoFsA8nfyigel11QCT2/i0/dFMN0Vp7vSMI8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036