UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'o7VOiDufKd4KLuX6Eq+yHIFkk1u7UEhGaNs2Pq1xpjY=' 
WHERE 
  key_id = '9d7375983a210524d55f7bc610be72bc5ec06dd92e44cf7020f9fd07be8d0b10' 
  AND (
    token = 'o7VOiDufKd4KLuX6Eq+yHIFkk1u7UEhGaNs2Pq1xpjY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020