UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+Nya3n8nL3J7tilw0B8O3csr+4qipS7mruIJNgSbxTs=' 
WHERE 
  key_id = '777cd50a7b6d9e57cc1df303b26d0c8d5ea784856f9ba5d46d8e706355cd9835' 
  AND (
    token = '+Nya3n8nL3J7tilw0B8O3csr+4qipS7mruIJNgSbxTs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027