UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bsaiVuvoMBzObiuQgz2JSXtpZKQBJf5vjRx1RaikYxM=' 
WHERE 
  key_id = 'f8e58e7dc3555d9e799e92b28bd96f47e531552fd2dccf15e43fa78d9917c740' 
  AND (
    token = 'bsaiVuvoMBzObiuQgz2JSXtpZKQBJf5vjRx1RaikYxM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029