UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iHVclsvTjUfboIpAHquy2aj3EFF8qRA3M78Bse5SN2Q=' 
WHERE 
  key_id = '7d40fdcfc3c44f27d58490c8cb9f5b917277473497c09e4b26f97a57472628cb' 
  AND (
    token = 'iHVclsvTjUfboIpAHquy2aj3EFF8qRA3M78Bse5SN2Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00064