UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZAS0iTiSSfojpM9XG+OgtaaK8Y6ErLFrrCEwfvik2LQ=' 
WHERE 
  key_id = '51a80b41ea120e637b8687b516802dd4b716b383254e81e309b4ef7c3e35607f' 
  AND (
    token = 'ZAS0iTiSSfojpM9XG+OgtaaK8Y6ErLFrrCEwfvik2LQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032