UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cWnS0pkwW+LAmmWBKhLf2Om70AfvkDIPgkHZChyMp+w='
WHERE
key_id = '9431b4cc53ed02c229aefb413daff148b19321af70053653c5989ab3801d891e'
AND (
token = 'cWnS0pkwW+LAmmWBKhLf2Om70AfvkDIPgkHZChyMp+w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)