UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Gf6316e+7dhxiB5h62Y2ZPyTjKYku8hp9m0vjnm4eBc='
WHERE
key_id = '32237cfa7db89fd80f383c505b7846ce60f3f881bf2afabebc0425be43cc9cef'
AND (
token = 'Gf6316e+7dhxiB5h62Y2ZPyTjKYku8hp9m0vjnm4eBc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)