UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZFidpghVlSfLndQaR7BI+u8jRsVMJF5okpimN5B7b0c=' 
WHERE 
  key_id = '2cdfac4d289198d30d152f5e373b35d022244d4ff09d6afa539cde78e85125e1' 
  AND (
    token = 'ZFidpghVlSfLndQaR7BI+u8jRsVMJF5okpimN5B7b0c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045