UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DwYlr7LbVSbrhrGm/QbUXMIz60BrbACOf32zcTnYSCk=' 
WHERE 
  key_id = '69da8773a6b9f97d4e303204b606476229befdbd26649614c19afd89589e7adb' 
  AND (
    token = 'DwYlr7LbVSbrhrGm/QbUXMIz60BrbACOf32zcTnYSCk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036