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

Query time 0.00024