UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QdYEoFlQzLvr7yZAggh9Bv4epiBOAg3zJdkeh0+COrc=' 
WHERE 
  key_id = '4660b2d2c66450cefb46d74f3cff9b702f262de7dba46666ec07aae08adf3b38' 
  AND (
    token = 'QdYEoFlQzLvr7yZAggh9Bv4epiBOAg3zJdkeh0+COrc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027