UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'A+fHAQwxEbxRDHulU5X6oXchFCYXnO90LvljJSYR/ws=' 
WHERE 
  key_id = '3b8c602178051e79ffdc9ae2a3bc01ea75edab87df390d1bdcccc1bb2d3a8d22' 
  AND (
    token = 'A+fHAQwxEbxRDHulU5X6oXchFCYXnO90LvljJSYR/ws=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041