UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1AV8ZIcory7cTP0GxKJlfVEulpi2rUdujNZOClgdZZw=' 
WHERE 
  key_id = 'ce72a0fa50681f1008b5b74b16df0a58878c941a3da200bd8db1c3b168d82899' 
  AND (
    token = '1AV8ZIcory7cTP0GxKJlfVEulpi2rUdujNZOClgdZZw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040