UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'zaPPyk/d+WNdhRtHaTsRtyI5kILP0Yaxhv6QNmW83N8='
WHERE
key_id = 'f41609948ff79a9032ce9504d83c52ad37b747eb2caab80e453e8989bfcb6cf9'
AND (
token = 'zaPPyk/d+WNdhRtHaTsRtyI5kILP0Yaxhv6QNmW83N8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)