UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QE0LOLlIWqh3byZpQzE91JhkA7q0LF80mL1PXoNR6gw='
WHERE
key_id = '0d9c1341e97549f1ec9e67f120376739b0f027ed282e9ece637b518f467cd616'
AND (
token = 'QE0LOLlIWqh3byZpQzE91JhkA7q0LF80mL1PXoNR6gw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)