UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ggaaX4IED4xbUUiejW67B0Al3j/gNfK/bVdTpUNwkD4=' 
WHERE 
  key_id = 'd4510c89224ab553345d4fc7ef6848932c32404e2b651957a44751c30181304f' 
  AND (
    token = 'ggaaX4IED4xbUUiejW67B0Al3j/gNfK/bVdTpUNwkD4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041