UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OsecGw2U4+XjvIphiH9oxGkt50IyVK5K3db2uWvkACk=' 
WHERE 
  key_id = '48cbaeaf0efa6b42f81040bacd9250f002c4813baf5aa19a4bc06320306b6632' 
  AND (
    token = 'OsecGw2U4+XjvIphiH9oxGkt50IyVK5K3db2uWvkACk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034