UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'C9nRSwYU64M8Apa2GDCr6Ize3tHQrr7zTWm13T+CgQI='
WHERE
key_id = '7fed1d89a3ba70de415a75a41dc01eb62052b089a48d332bebd4dae0f70dc032'
AND (
token = 'C9nRSwYU64M8Apa2GDCr6Ize3tHQrr7zTWm13T+CgQI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)