UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fNkubJKQGhiC+pE4KtS4ClEI9lIHs2pKq97Qm6E7jQc='
WHERE
key_id = '6386c0f847b54df7de0104db8fb46c012f0506a6d823f3d654e3967d7483c307'
AND (
token = 'fNkubJKQGhiC+pE4KtS4ClEI9lIHs2pKq97Qm6E7jQc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)