UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TKg4bapeUmcG0hoqKmhaEiIfvx7c2oRIGZo9SodzKmI='
WHERE
key_id = 'b31d8610675fbe9e7b8a09853572acb95b06ca9bccfc2a4f33ed02a4c14ea45d'
AND (
token = 'TKg4bapeUmcG0hoqKmhaEiIfvx7c2oRIGZo9SodzKmI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)