UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'a3Osm7ygHVkrkWcUq7in6UbG8gZSN73ADi0wx/JDgXc=' 
WHERE 
  key_id = 'ec6054591d3edb78c75a9ef641ce63c602381b47cb4931437e71e665868be245' 
  AND (
    token = 'a3Osm7ygHVkrkWcUq7in6UbG8gZSN73ADi0wx/JDgXc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034