UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bDkjWqFg/zyBkw+zMyKbghRAHFTML8ENJRe+YXkigVk=' 
WHERE 
  key_id = 'cad9b315c7625b1349c92961ba0374452e9750347c449e111d269b5013db1d5b' 
  AND (
    token = 'bDkjWqFg/zyBkw+zMyKbghRAHFTML8ENJRe+YXkigVk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022