UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'o7KfOOcwiev9O82fCbFDi9k6Kh8aCE0rJYLYptAa4aE=' 
WHERE 
  key_id = '1c5a352132d0fb98b1538974e1ed648e587e4e1b5541dcc322841e09125580bd' 
  AND (
    token = 'o7KfOOcwiev9O82fCbFDi9k6Kh8aCE0rJYLYptAa4aE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037