UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'q+haA4T+Jloj378kdrSOgXXJnbb6yVCwOA6GhLckOnY=' 
WHERE 
  key_id = 'edcf358a4026978cf282241ea4bdf1faef59b3bc6c37a778946ed4a31e374f64' 
  AND (
    token = 'q+haA4T+Jloj378kdrSOgXXJnbb6yVCwOA6GhLckOnY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024