UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'V8w3MGuS0RNEHiyHosg7/AZi7t1Fo+zIhrkRpw3tyRU=' 
WHERE 
  key_id = '1f51346263d9dcb91033ce07137ea62816e266c1f54c33482ee10df292efcfdd' 
  AND (
    token = 'V8w3MGuS0RNEHiyHosg7/AZi7t1Fo+zIhrkRpw3tyRU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042