UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uQPpwgR8HDPA21/Jv2rkD09u2nWhvmHsBU3We9Mkm+s=' 
WHERE 
  key_id = 'ac9ad95e60289827f280a38abce934638d157b460370c5c91913028e43e262ae' 
  AND (
    token = 'uQPpwgR8HDPA21/Jv2rkD09u2nWhvmHsBU3We9Mkm+s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026