UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CnzH8CIis23zCalp2xNxrMQv9PDI7x8kOaNOxMMlzDw='
WHERE
key_id = '10df56f2db36906a667b65a5f20675330f7f25763b35f1269fa15f6a854945a6'
AND (
token = 'CnzH8CIis23zCalp2xNxrMQv9PDI7x8kOaNOxMMlzDw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)