UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8g6J0NQw9qPqP1aRC1pGswj1nFdUCGmtzmsGlKmpwao='
WHERE
key_id = 'bc7ee8c4c585568585c60485a7c6b45a3409e592e484bec5e629fdbeb72c1682'
AND (
token = '8g6J0NQw9qPqP1aRC1pGswj1nFdUCGmtzmsGlKmpwao='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)