UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'G+njuoY1L129qbMf5vblK26N48HoX5rrjP+kZWCSaxY=' 
WHERE 
  key_id = '0eb07777644a729ab7a5962b5f28215d404a42d54f9a107bd4f8c531c4d52d18' 
  AND (
    token = 'G+njuoY1L129qbMf5vblK26N48HoX5rrjP+kZWCSaxY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023