UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ERPGoPwXh2Hi4SFK9aCP6IcPc0vCVVhuKd0+NcL1RdM=' 
WHERE 
  key_id = '6672ab2640d98b89ec6e45a3c1d5508901d86dc42db364979ee9bbdb7e3e65af' 
  AND (
    token = 'ERPGoPwXh2Hi4SFK9aCP6IcPc0vCVVhuKd0+NcL1RdM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033