UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bCZTGOgxvgk+XhbAuVdFCxdpYDLBgQzX9s8Sdh8DGg8='
WHERE
key_id = 'f05794e5aad7426b95720b51651de927f0b482384585a2466884c4fd4726423c'
AND (
token = 'bCZTGOgxvgk+XhbAuVdFCxdpYDLBgQzX9s8Sdh8DGg8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)