UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2gUOUnhCn2kcxTVBs0Zq2h2k/Ecq8uMStQ+vD4nmO4g='
WHERE
key_id = 'd61100dd104bf3019e13c47acc8c39efcd8fc66898f5a44267f9a7a4ff8df946'
AND (
token = '2gUOUnhCn2kcxTVBs0Zq2h2k/Ecq8uMStQ+vD4nmO4g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)