UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rEvO4SkuPQdrcXRiAmOUfjiSZ0L1l7z6c3dDbZrKwqo=' 
WHERE 
  key_id = '319766d6ed361374b78dfe8b3e5a221aa3161e8babafc6b8cd06c5ab2ff68327' 
  AND (
    token = 'rEvO4SkuPQdrcXRiAmOUfjiSZ0L1l7z6c3dDbZrKwqo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043