UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IExlgb2lRkOhBhKicQRvGlt592JAqU6LKQkfNxtONeM=' 
WHERE 
  key_id = '428a5c862607094ee51b2db02904c9315423268aac347da364175091eb9e38cc' 
  AND (
    token = 'IExlgb2lRkOhBhKicQRvGlt592JAqU6LKQkfNxtONeM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026