UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GrnBE5D8Y2+TsHHuqnXvMk/bzY352VSgwTHMPAyg3SY=' 
WHERE 
  key_id = '59ebefa1846004d9f5bd912e6bcea71873b2489ac5dc6c36c5dfc1d64d21eb6e' 
  AND (
    token = 'GrnBE5D8Y2+TsHHuqnXvMk/bzY352VSgwTHMPAyg3SY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028