UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'zqCwmUzF28iPCxXVEU/sSSUlrm0KtWcuAWEINRcuA7I='
WHERE
key_id = '3f75047d4a451aa05efd8fefb314f5e72a4dbe3aedd2a788dde97ba47678299f'
AND (
token = 'zqCwmUzF28iPCxXVEU/sSSUlrm0KtWcuAWEINRcuA7I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)