UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tbkvlBQ2inxbcyzPoze23PkHJus+ty9IOvIifzrsPB4=' 
WHERE 
  key_id = '0e60ef448d1bae5f293e2c3d27400f99a9e82352f79e92ed898acba5c768e731' 
  AND (
    token = 'tbkvlBQ2inxbcyzPoze23PkHJus+ty9IOvIifzrsPB4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031