UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '77o9xh8WsiCdvsXdOf25v4Kt1trM5jaY/X1R7DdDiCk='
WHERE
key_id = '183b4e87e5060fe147abc6cc3b7bcf3b3df9d92097686240eeb17b28e6823781'
AND (
token = '77o9xh8WsiCdvsXdOf25v4Kt1trM5jaY/X1R7DdDiCk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)