UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4BhQqgDBO2R/D7sARfIvCDthj4ZQVYT+bDHAd7CQQnU=' 
WHERE 
  key_id = 'c219a9f94ee08ff6d7c3a18a146ba51c1c97d8870f85ae99e3d7322fef9384ef' 
  AND (
    token = '4BhQqgDBO2R/D7sARfIvCDthj4ZQVYT+bDHAd7CQQnU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046